var utils = {
    top : $(".navbar-fixed-top").load("/common/html/top.html"),
    //menu: $(".page-sidebar").load("/common/html/menu.html"),
    footer: $(".footer").load("/common/html/footer.html")

};
/*var menuMap = {};
menuMap['sys/index'] = '/htm/index.html';
menuMap['sys/home'] = '/htm/home.html';
menuMap['sys/user'] = '/htm/user.html';*/






/*function menuMap() {
    this.keys = new Array();
    this.data = new Object();
    //存入数据
    this.put = function(key, value) {
        if(this.data[key] == null){
            this.keys.push(key);
        }
        this.data[key] = value;
    };
    //获取
    this.get = function(key) {
        return this.data[key];
    };
    //遍历
    this.each = function(fn){
        if(typeof fn != 'function'){
            return;
        }
        var len = this.keys.length;
        for(var i=0;i<len;i++){
            var k = this.keys[i];
            fn(k,this.data[k],i);
        }
    };



   /!* {
            index : "/htm/index.html"},
        {
            userManger: "/htm/userList.html"},
        {
            roleManger:"/htm/roleList.html"
        }
    )*!/
}*/

function Router(){
    this.routes = {};
    this.curUrl = '';

    this.route = function(path, callback){
        this.routes[path] = callback || function(){};
    };

    this.refresh = function(){
        this.curUrl = location.hash.slice(1) || '/';
        this.routes[this.curUrl]();
    };
    this.init = function(){
        window.addEventListener('load', this.refresh.bind(this), false);
        window.addEventListener('hashchange', this.refresh.bind(this), false);
    }
}




